{extend name="public/base" /}

{block name="title"}<title>{if condition="$data"}{$Think.lang.edit}{else /}{$Think.lang.create}{/if}</title>{/block}

{block name="pjax_container"}
<section class="content-header">
    <h1>{:isset($data.id)?"修改":"添加"}客户</h1>
    <ol class="breadcrumb">
        <li class="active"><i class="fa fa-dashboard"></i> {:isset($data.id)?"修改":"添加"}客户</li>
    </ol>
</section>
<section class="content">
    <div class="row">
        <div class="col-md-12">
            <form class="form-horizontal" method="POST" action="" onsubmit="return false" >
                <div class="nav-tabs-custom">
                    <ul class="nav nav-tabs">
                        <li class="active"><a href="#tab1" data-toggle="tab">{$Think.lang.base_param}</a></li>
                        <li class="pull-right"><a href="javascript:history.back(-1)" class="btn btn-sm" style="padding:10px 2px;"><i class="fa fa-list"></i> {$Think.lang.back}</a></li>
                    </ul>
                    <div class="tab-content">
                        <div class="tab-pane active" id="tab1">
                            <input type="hidden" name="id" value="{$data.id}" />

                            <div class="form-group">
                                <label class="col-sm-2 control-label">{$Think.lang.company}</label>
                                <div class="col-sm-7"><input class="form-control" name="company" value="{$data.company}" placeholder="{$Think.lang.company1}"></div>
                            </div>

                            <div class="form-group">
                                <label class="col-sm-2 control-label">{$Think.lang.address}</label>
                                <div class="col-sm-7"><input class="form-control" name="address" value="{$data.address}" placeholder="{$Think.lang.address1}"></div>
                            </div>

                            <div class="form-group">
                                <label class="col-sm-2 control-label">{$Think.lang.name}</label>
                                <div class="col-sm-7"><input class="form-control" name="name" value="{$data.name}" placeholder="{$Think.lang.name1}"></div>
                            </div>

                            <div class="form-group">
                                <label class="col-sm-2 control-label">{$Think.lang.position}</label>
                                <div class="col-sm-7"><input class="form-control" name="position" value="{$data.position}" placeholder="{$Think.lang.position1}"></div>
                            </div>

                            <div class="form-group">
                                <label class="col-sm-2 control-label">{$Think.lang.phone}</label>
                                <div class="col-sm-7"><input class="form-control" name="phone" value="{$data.phone}" placeholder="{$Think.lang.phone}"></div>
                            </div>

                            <div class="form-group">
                                <label class="col-sm-2 control-label">{$Think.lang.manager_status}</label>
                                <div class="col-sm-7">
                                    <select class="form-control select1" name="manager_status" style="width:100%;">
                                        <option value="0" {$data.manager_status == "1"?"":"selected"}>否</option>
                                        <option value="1" {$data.manager_status == "1"?"selected":""}>是</option>
                                    </select>
                                </div>
                            </div>

                            <div class="form-group">
                                <label class="col-sm-2 control-label">{$Think.lang.transfer}</label>
                                <div class="col-sm-1">
                                    <input type="text" class="form-control transfer" value="{$data.transfer1}" placeholder="{$Think.lang.transfer1}">
                                    <input type="hidden" class="form-control transfer1" name="transfer" value="{$data.transfer}" placeholder="{$Think.lang.transfer1}">
                                </div>
                                <span class="btn btn-primary transfer-span" data-toggle="modal" data-target="#myModal">{$Think.lang.transfer1}</span>
                            </div>

                            <div class="form-group">
                                <label class="col-sm-2 control-label">{$Think.lang.type}</label>
                                <div class="col-sm-7">
                                    <select class="form-control select2" name="type" style="width:100%;">
                                       <option value="A" {$data.type == "A"?"selected":""}>A</option>
                                       <option value="B" {$data.type == "B"?"selected":""}>B</option>
                                       <option value="C" {$data.type == "C"?"selected":""}>C</option>
                                    </select>
                                </div>
                            </div>

                            <div class="form-group">
                                <label class="col-sm-2 control-label">{$Think.lang.entry_name}</label>
                                <div class="col-sm-7"><input class="form-control" name="entry_name" value="{$data.entry_name}" placeholder="{$Think.lang.entry_name1}"></div>
                            </div>

                            <div class="form-group">
                                <label class="col-sm-2 control-label">{$Think.lang.sales_name}</label>
                                <div class="col-sm-7"><input class="form-control" name="sales_name" value="{$data.sales_name}" placeholder="{$Think.lang.sales_name1}"></div>
                            </div>
                        </div>
                    </div>
                    <div class="box-footer">
                        <div class="col-sm-2"></div>
                        <div class="col-sm-7">
                            <div class="btn-group pull-right">
                                <button type="submit" class="btn btn-info pull-right submits" data-loading-text="&lt;i class='fa fa-spinner fa-spin '&gt;&lt;/i&gt; {$Think.lang.submit}">{$Think.lang.submit}</button>
                            </div>
                            <div class="btn-group pull-left">
                                <button type="reset" class="btn btn-warning">{$Think.lang.reset}</button>
                            </div>
                        </div>
                    </div>
                </div>
            </form>
            <div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
                <div class="modal-dialog">
                    <div class="modal-content">
                        <div class="modal-header">
                            <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
                            <h4 class="modal-title" id="myModalLabel">选择转移目标</h4>
                        </div>
                        <div class="modal-body">
                            <form class="mod-from">
                            {volist name="sel" id="vo"}
                                <input type="radio" name="sel" value="{$vo.id}" class="minimal" data-name="{$vo.name}">{$vo.name}
                            {/volist}
                            </form>
                        </div>
                        <div class="modal-footer">
                            <button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
                            <button type="button" class="btn btn-primary mod-sub">确定</button>
                        </div>
                    </div><!-- /.modal-content -->
                </div><!-- /.modal -->
            </div>
        </div>
    </div>
</section>
<script type="text/javascript">
$(function(){
    /*ajax页面加载icheck，有该控件的页面才需要*/
    $('input[type="checkbox"].minimal, input[type="radio"].minimal').iCheck({
        checkboxClass: 'icheckbox_minimal-blue',
        radioClass: 'iradio_minimal-blue'
    });
    
    /*ajax页面加载icheck，有该控件的页面才需要*/
    $(".select2").select2({language:"zh-CN"});
    
    {if condition=" $rest_login == 1 "}
    restlogin('{$rest_login_info}');   //登录超时
    {/if}
    $('.transfer-span').click(function(){
        var auth = "{$group_id}";
        if(auth != '1'){
            return false;
        }
    });
    $('.mod-sub').click(function(){
        $('.transfer').val($("input[name='sel']:checked").data('name'));
        $('.transfer1').val($("input[name='sel']:checked").val());
        $('#myModal').modal('hide');
    })
})
</script>
{/block}